﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using WLMCoreLibrary;
using Newtonsoft.Json;

namespace MWS_Blog.Json
{
    public partial class Tags : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            dbConnector ConexionDB = new dbConnector();
            StringBuilder lista = new StringBuilder();
            MiWebSiteBlogTagCollection cats = new MiWebSiteBlogTagCollection(ref ConexionDB);
            ConexionDB.CloseConnection();
            List<Tag> tags = new List<Tag>();
            foreach (MiWebSiteBlogTag item in cats.Elementos)
            {
                tags.Add(new Tag(item.NombreTag, item.NombreTag));
            }
            Response.ContentType = "application/json";
            Response.Write(JsonConvert.SerializeObject(tags));
            Response.End();
        }
    }
}